<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <title>微服务开发-结合Bootstrap页面布局-条纹表格</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <script th:src="@{/js/jquery.min.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <style>
        table td{
            width: 10%;
        }
    </style>
</head>
<body style="padding-left: 100px; padding-right: 100px;">
    <table class="table table-striped">
        <caption><a th:href="@{/user/toAddUser}">添加用戶</a></caption>
        <thead>
        <tr>
            <th>序号</th>
            <th>id</th>
            <th>呢称</th>
            <th>联系电话</th>
            <th>电子邮箱</th>
            <th>联系地址</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="user : ${userList}">
            <td th:text="${userStat.count}"></td>
            <td th:text="${user.id}"></td>
            <td th:text="${user.nick}"></td>
            <td th:text="${user.phone}"></td>
            <td th:text="${user.email}"></td>
            <td th:text="${user.address}"></td>
            <td>
                <a th:href="@{'/user/toUpdate?id='+ ${user.id}}">修改</a>
                <a th:href="@{'/user/delete?id='+ ${user.id}}">刪除</a></td>
        </tr>
        <tr style="text-align: center;">
            <td colspan="7">
                <span th:if="${curPage <= 1}">
                    首页
                    上一页
                </span>
                <span th:if="${curPage > 1}">
                    <a th:href="@{/index}">首页</a>
                    <a th:href="@{'/index?curPage='+ ${curPage-1}}">上一页</a>
                </span>
                <span th:if="${curPage < totalPages}">
                    <a th:href="@{'/index?curPage='+ ${curPage+1}}">下一页</a>
                    <a th:href="@{'/index?curPage='+ ${totalPages}}">尾页</a>
                </span>
                <span th:if="${curPage == totalPages}">
                    下一页
                    尾页
                </span>

            </td>
        </tr>
        </tbody>
    </table>
</body>
</html>